<%@LANGUAGE="VBSCRIPT" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Save Report File Data</title>
<link href="UniversalStyleSheet.css" rel="stylesheet" type="text/css" />
</head>

<body>
<%
 set fs=server.CreateObject("scripting.filesystemobject")
root=server.MapPath("reports")
set ReportFolder=fs.getfolder(root)
set filecol=ReportFolder.Files
x=0
response.Write("<span class='ResultsName'>" & reportfolder & "</span>")
%>
<table cellspacing="1" bgcolor="#009900">
<tr>
<td class="DispatchHeaders" bgcolor="#FFFFFF" width="200"><a href="SaveReportFileData.asp?sort=filename">Name</a>
</td>
<td class="DispatchHeaders" bgcolor="#FFFFFF" width="125"><a href="SaveReportFileData.asp?sort=createddate+desc">Date Created</a>
</td>
</tr>
<%
set rs=server.CreateObject("adodb.recordset")
Const adInteger = 3
Const adDate = 7
Const adVarChar = 200
with rs.fields
	.append "FileName",adVarChar,250
	.append "CreatedDate",AdDate
end with
rs.open()
for each f in filecol
	if fs.getExtensionName(f)="xls" then
		rs.addnew
		rs("FileName")=f.name
		rs("CreatedDate")=f.datecreated
		rs.update
	end if
next
sortval=request.QueryString("sort")
if sortval="" then sortval="createddate desc"
sortval=replace(sortval,"+"," ")
rs.sort=sortval

if not rs.eof then
	rs.movefirst
	do until rs.eof
		%>
		<tr>
		<td bgcolor="#ffffff" class="ResultsAddress">
		<a href="reports/<%= rs("filename") %>" title="Click to Open Report:'<%= rs("filename") %>'" target="_blank"><img src="Images/excel.jpg" width="16" height="16" border="0"/> <%= rs("filename") %> </a>		</td>
		<td bgcolor="#ffffff" class="ResultsAddress" ><%= rs("createddate") %> 
		</td>
		</tr>
<% 
		rs.movenext
	loop
else 
	response.Write("<tr><td colspan=2 class='ResultsAddress' bgcolor='#ffffff'>(none)</td></tr>")
end if
set fs=nothing
rs.close
set rs=nothing
%>
</table>
</body>
</html>
